<template>
    <div>
        <el-dialog @close="closeFn" v-model="visibles" width="45%" :show-close="true">
            <div v-loading="loading" element-loading-text="加载中...">
                <div class="head">{{ item.info.zh_title || item.info.title }}</div>
                <!-- 时间 -->
                <div class="time">{{ item.info.news_time }}</div>
                <div class="count">
                    <div class="neiRong">
                        {{ item.info.zh_content || item.info.content }}</div>
                </div>
                <!-- 这个是左右箭头 -->
                <div class="arrow f f-a-c f-j-b">
                    <img src="/src/status/jiantou/zuo.png" @click="zuobian" class="zuoImg" alt="">
                    <img src="/src/status/jiantou/you.png" class="zuoImg" @click="youbian" alt="">
                </div>
            </div>
        </el-dialog>
    </div>
</template>

<script setup>
import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
// import second from ''
let visibles = ref(false)
let loading = ref(false)
const emit = defineEmits(['zuobian', 'youbian'])
// 组件传值
const props = defineProps({
    item: {
        default: {},
        type: Object,
    },

});
// 点击右上面叉号
const closeFn = () => {
    visibles.value = false
}
// 点击左下面箭头
// 点击左下面箭头
const zuobian = () => {
    if (!props.item.pre_spot_id) {
        return ElMessage('已经到头了~')
    }
    console.log(props.item, '00000000');
    emit('zuoFerter', props.item.pre_spot_id)
}
// 点击右下面箭头
const youbian = () => {
    if (!props.item.next_spot_id) {
        return ElMessage('已经到头了~')
    }
    console.log(props.item, '00000000');
    emit('youFerter', props.item.next_spot_id)
}
// 暴露
defineExpose({
    visibles,
    loading
});
</script>

<style lang="scss" scoped>
@function pxfn($px) {
    @return calc($px / 18.4) * 1vw;
}

.arrow {
    margin-top: pxfn(0);

    .zuoImg {
        width: pxfn(44);
        height: pxfn(44);
    }
}

.head {
    font-size: pxfn(22);
    font-family: PingFang SC, PingFang SC-600;
    font-weight: 600;
    text-align: left;
    color: #1d2129;
}

.count {
    height: 60vh;
    overflow-y: auto;

    &::-webkit-scrollbar {
        // 隐藏滚动条将宽度设置为0
        background-color: #e8eaec;
        width: 0 !important;
    }
}

.neiRong {
    font-size: pxfn(14);
    font-family: PingFang SC, PingFang SC-400;
    font-weight: 400;
    // text-align: LEFT;
    color: #4e5769;
    line-height: 2;
}

.time {
    font-size: pxfn(14);
    font-family: PingFang SC, PingFang SC-400;
    font-weight: 400;
    text-align: LEFT;
    color: #868d9c;
    margin: pxfn(15) 0;
}

::v-deep .el-dialog {
    border-radius: pxfn(15) !important;
}

::v-deep .el-dialog__headerbtn {
    font-size: pxfn(26) !important;
}

::v-deep .el-dialog__body {
    padding-top: pxfn(5);
    padding-bottom: pxfn(5);
}

::v-deep .el-dialog {
    --el-dialog-margin-top: 10vh;
}
</style>